export default {
  namespaced: true, //命名空间
  state: {
    //导航标签页的数据
    PanesData: [
      {
        title: "通知",
        key: "0",
        closable: false, //是否可关闭
        type: "apple", //图标
        component: "notice", //渲染组件
      },
      {
        title: "测试",
        key: "1",
        type: "apple", //图标
        component: "testTopic",
        closable: false,
      },
    ],
    //导航标签页选中Key
    PanesActiveKey: "0",
    //是否存在测试页面
    isTestPage: false,
    //选择的测试id
    testKey: "",
    //题目数据
    Topics: [],
    //当前学生的实习小组信息
    StudentGroupInfo: {},
  },
  getters: {},
  mutations: {
    setPanesActiveKey(state, data) {
      state.PanesActiveKey = data;
    },
    setStudentGroupInfo(state, data) {
      state.StudentGroupInfo = data;
    },
    //开始测试
    addPanesData(state, data) {
      state.PanesData.push({
        title: data.title,
        key: state.PanesData.length.toString(),
        closable: true, //是否可关闭
        type: "apple", //图标
        component: "exercise",
      });
      state.testKey = data.key; //选择的测试id
      state.isTestPage = true;
      state.PanesActiveKey = `${state.PanesData.length - 1}`;
    },
    //退出测试
    removePandesData(state) {
      state.PanesData = state.PanesData.slice(0, -1);
      state.PanesActiveKey = "1"; //对应的测试导航页key
      state.isTestPage = false;
    },
    setTopics(state, data) {
      state.Topics = data;
    },
  },
  actions: {},
  modules: {},
};
